
package com.example.secondhandsysapi.Service;

import com.example.secondhandsysapi.Entity.CommentInfo;
import com.example.secondhandsysapi.Vo.Comment;
import com.example.secondhandsysapi.Vo.UserInfoCommentInfo;
import com.example.secondhandsysapi.Mapper.CommentInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentInfoServiceImpl implements CommentInfoService {
    @Autowired
    private CommentInfoMapper commentInfoMapper;

    @Override
    public List<CommentInfo> getAllUpdateCommentInfo(String comment_description) {
        List<CommentInfo> i=  commentInfoMapper.getAllUpdateCommentInfo(comment_description);
        return i;
    }

    @Override
    public Integer updateStatus(Integer comment_id) {
        Integer i = commentInfoMapper.updateStatus(comment_id);
        return  1;
    }

    @Override
    public Integer updateCheck_Info(String check_info, Integer comment_id) {
        Integer i=commentInfoMapper.updateCheck_Info(check_info,comment_id);
        return i;
    }

    //获取分页信息
    @Override
    public PageInfo<CommentInfo> getCommentInfo(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<CommentInfo> i= commentInfoMapper.getAllUpdateCommentInfo("");
        PageInfo<CommentInfo> pageInfo = new PageInfo<>(i);
        return pageInfo;
    }
   // package com.example.secondhandsysapi.Service;

//import com.example.secondhandsysapi.Mapper.CommentInfoMapper;

   @Override
    public List<UserInfoCommentInfo> getAllCommentInfoAndUserInfo(Integer id) {
       return  commentInfoMapper.getAllCommentInfoAndUserInfo(id);
        }

     @Override
      public List<UserInfoCommentInfo> getAll() {
        return commentInfoMapper.getAll();
        }

    //个人中心显示信誉
    @Override
    public List<CommentInfo> getUserCommentInfo(Integer user_id) {
        return commentInfoMapper.getUserCommentInfo(user_id);
    }

    @Override
    public Integer InsertComment(Integer user_id, Integer goods_id, String comment_description, Integer goods_mark, Integer logistics_mark, Integer service_mark) {
        return commentInfoMapper.InsertComment(user_id,goods_id,comment_description,goods_mark,logistics_mark,service_mark);
    }

    @Override
    public List<Comment> showCommentInfo(Integer goods_id) {
        return commentInfoMapper.showCommentInfo(goods_id);
    }
    }





